package com.chenglu.android.ordercomment.mvp.model;





import com.chenglu.android.common.net.RetrofitClient;
import com.chenglu.android.common.net.RetrofitClientCL;
import com.chenglu.android.mine.bean.CommonDataBean;
import com.chenglu.android.mine.bean.PutFileBean;
import com.chenglu.android.ordercomment.mvp.contract.OrderCommentContract;

import java.io.File;

import io.reactivex.rxjava3.core.Observable;
import okhttp3.MediaType;
import okhttp3.MultipartBody;
import okhttp3.RequestBody;

/**
 * @author: lyj
 * @Created by Copyright 2023/3/2 Guangzhou Hongma Technology Co., Ltd. All rights reserved.
 *
 */
public class OrderCommentModel implements OrderCommentContract.OrderCommentModel {

    @Override
    public Observable<CommonDataBean> getOrderComment(String token, RequestBody requestBody) {
        return RetrofitClientCL.getInstance().getApi().getOrderComment(token,requestBody);
    }

    @Override
    public Observable<PutFileBean> getPutFile(String token, File file) {
        RequestBody requestFile = RequestBody.create(MediaType.parse("multipart/form-data"), file);
        MultipartBody.Part part = MultipartBody.Part.createFormData("file", file.getName(), requestFile);

        return RetrofitClientCL.getInstance().getApi().getPutFile(token,part);
    }


}
